<script>
export default {
  name: "myorder",
  data() {
    return {
      memberDetail: {

      },
      historyList: []
    }
  },
  onShow() {
    this.$api.memberDetail(uni.getStorageSync('memberId')).then(res => {
      this.memberDetail = res
      this.$api.connectionHistoryList({
        member_id: this.memberDetail.id,
        device_id: this.memberDetail.device_id
      }).then(res2 => {
        console.log(res2)
        this.historyList = res2
      })
    })
  },
}
</script>

<template>
  <div class="order">
    <div class="history-item" v-for="item in historyList" :key="item.id">
      <div class="history-item-title">
        设备名称：{{ item.device.name }}
      </div>
      <div class="history-item-title" style="margin: 20rpx 0">
        时间：{{ item.create_time }}
      </div>
      <div class="history-item-content">
        <div>连接状态：{{ item.type == 1 ? '连接' : '断开' }}</div>
      </div>
    </div>
    <u-empty v-if="historyList.length === 0" text="暂无使用记录" mode="list"></u-empty>
  </div>
</template>

<style lang="scss">
.order {
  min-height: 100%;
  background-color: #F5F7FA;
  padding: 20rpx;
  .history-item {
    border-radius: 10px;
    background-color: #FFFFFF;
    padding: 20rpx;
    margin-bottom: 20rpx;
  }
}
</style>